<?
function call_remote_method($func,$print_response=''){

	global $id;
//if($id==6324)$print_response=1;
	$remote_host="www.lonex.com";
	$remote_port=8000;
	$remote_page="/members/outer_functionality/remote.php";
	$secret="kuramiqnko";
	$f=base64_encode(serialize($func));
	$checksum=md5("$secret$f");
	$arr[checksum]=$checksum;
	$arr[method]=$f;
	$data="data=".urlencode(base64_encode(serialize($arr)));
	$post="GET $remote_page?$data HTTP/1.0\n\rUser-Agent: Mozilla/4.0 (compatible; GoogleToolbar 1.1.68-big; Windows XP 5.1)\n\rHost: www.lonex.com:80\n\rPragma: no-cache\n\r\n\r";
//	echo $post;
	$fp=@fsockopen($remote_host,$remote_port, $errno, $errstr, 30);
	if($fp){
		fputs ($fp, $post);
		while (!feof ($fp)) {
			 $buffer = fgets($fp, 4096);
			 $result.=$buffer;
		}
		fclose ($fp);
	}else {
		exit("err: $errstr<br>err no: $errno");
	}
	
	if($print_response)echo "|$result|";
	preg_match("/;%;%.*;%;%/",$result,$matches);
	if(!is_array($matches)) exit("!!!!");
	$res=substr($matches[0],4);
	$res=substr($res,0,strlen($res)-4);
	$res=unserialize(base64_decode($res));
if($print_response)print_r($res);	
//if(!$res || $res===0) echo "$result";
	if(!isset($res)) exit("no result returned\n\n$result");
	return $res;
	
}
?>
